class ProgramsController < ApplicationController

	def index

		@programs = Program.all

	end

	def show

		@program= Program.find(params[:id])
		@allTestimonials = Testimonial.all
		@allProjects = Project.all

	end

	def new
		@program = Program.new
	end

	def create
		@program = Program.new(params[:program])

		if @program.save

		redirect_to :action => "show", :id => params[:id]

		else

			render "new"

		end

	end

	def edit

		@program = Program.find(params[:id])

	end

	def update
		@program = Program.find(params[:id])

		if @program.update_attributes(params[:program])
					redirect_to :action => "show", :id => params[:id]

		else

			render "edit"

		end
	end

	def destroy

		@program = Program.find(params[:id])
		 @program.destroy
			redirect_to programs_path , :notice => "Your Post was deleted"
			
	end

end
